/*
* @author suhong
* @date 2022/5/17 19:59
* @file index.js
* @说明  vuex
*/
import Vue from 'vue'
import Vuex from 'vuex'
import VueXAlong from 'vuex-along'
Vue.use(Vuex)
const state={
    commitSum:{},//存储数据
    isLogin:false,//是否登录
    
}
//操作数据
const mutations={
    setUserInfo(state,value){
        state.commitSum=value
        state.isLogin=true
    },
    Logout(state){
        state.commitSum=null
        state.isLogin=false
    }
}
const getters={
    //获取数据
    getUserinfo:state=> state.commitSum.username,
    //是否登录
    getIsLogin:state=>state.isLogin,
    //获取头像
    getIcon:state=> state.commitSum.userIcon
}

export default  new Vuex.Store({
    state,
    getters,
    mutations,
    plugins:[VueXAlong()]
})